﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace AcctrueWMS.Foundation.Common
{
    public class Cache:ICache
    {
        public object this[string key]
        {
            get
            {
                return HttpRuntime.Cache[key];
            }
            set
            {
                HttpRuntime.Cache[key]=value;
            }
        }

        public bool ContainsKey(string key)
        {
            object o = HttpRuntime.Cache[key];

            bool isCaching = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["IsCaching"]);

            if (isCaching == false)  //如果在没有开启缓存的情况下都返回 false 仅仅为了开发方便以后可以去掉
                return false;

            if (o == null)
                return false;
            else
                return true;
        }
    }
}
